package com.scs.application.modules.fsd.controller;

import com.scs.application.modules.fsd.service.FsdUserService;
import com.scs.application.modules.sys.model.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 */
@RestController
@RequestMapping("/back_front/validate")
public class ValidateController {
    @Autowired
    private FsdUserService userService;
//    /**
//     * 后台管理登录
//     * @param map
//     * @return
//     */
//    @PostMapping(value = "/login")
//    public RestResult frontLogin(@RequestBody Map<String, String> map) {
//        LoginResult loginResult = userService.frontLogin(map.get("username"), map.get("password"));
//        return RestResult.ok("登录成功", loginResult.getToken());
//    }

    @GetMapping(value = "/info")
    public RestResult info(@RequestParam("token") String token) {
        if (userService.info(token)) {
            return RestResult.ok("获取用户信息成功","{ name: '管理员', avatar: ''}");
        } else {
            return RestResult.error("获取用户信息失败",null);
        }
    }
}
